# 导包
# import requests, app
#
#
# # 创建封装的员工类
# class EmployeeApi:
#     def __init__(self):
#         self.url_employee = app.BASE_URL + "/api/sys/user"  # 员工模块的URL
#
#     # 封装员工列表接口
#     def query_employee_list(self, headers):
#         return requests.get(url=self.url_employee, params={"page": "1", "size": "10"}, headers=headers)
#
#     # 封装添加员工接口
#     def add_employee(self, headers, jsonData):
#         return requests.post(url=self.url_employee,
#                              headers=headers,
#                              json=jsonData)
#
#     #
#     # 封装查询员工接口
#     def query_employee(self, headers, target):
#         url_query = self.url_employee + "/" + target  # 拼接查询员工的URL
#         print("查询员工URL为: ", url_query)
#         return requests.get(url_query, headers=headers)
#
#     # 封装修改员工接口
#     def update_employee(self, headers, target, jsonData):
#         url_modify = self.url_employee + "/" + target  # 拼接修改员工的URL
#         print("修改员工的URL为: ", url_modify)
#         return requests.put(url_modify,
#                             headers=headers,
#                             json=jsonData)
#
#     # 封装删除员工接口
#     def delete_employee(self, headers, target):
#         url_delete = self.url_employee + "/" + target  # 拼接删除员工的URL
#         print("删除员工的URL: ", url_delete)
#         return requests.delete(url_delete, headers=headers)

# 第一步：封装部门模块接口（组织架构）
# 导包
import requests, app


# 创建封装的部门类
class Department:
    def __init__(self):
        self.url_department = app.BASE_URL + "/api/company/department/"

    # 封装部门列表接口
    def department_list(self, headers):
        return requests.get(url=self.url_department, headers=headers)

    # 封装部门信息接口
    def message_department(self, headers, id):
        url_update = self.url_department + "/" + id
        print("部门信息的URL为: ", url_update)
        return requests.get(url_update,headers=headers, )

    # 封装添加部门接口
    def add_department(self, headers, jsonData):
        return requests.post(url=self.url_department,
                             headers=headers,
                             json=jsonData)

    # 封装修改部门接口
    def update_department(self, headers, id, jsonData):
        url_update = self.url_department + "/" + id
        print("修改部门的URL为: ", url_update)
        return requests.put(url_update,
                            headers=headers,
                            json=jsonData)

    # 封装删除部门接口
    def delete_department(self, headers, id):
        url_delete = self.url_department + "/" + id
        print("删除部门的URL为: ", url_delete)
        return requests.delete(url_delete, headers=headers)
